# 自定义分页
def get_pagerange(page_obj,before_range_num,after_range_num):
    current_index = page_obj.number
    start = current_index - before_range_num
    end = current_index + after_range_num
    if start <= 0:
        start = 1
    if end >= page_obj.paginator.num_pages:
        end = page_obj.paginator.num_pages
    return range(start, end + 1)